﻿import com.dmotiko.general.*
import com.dmotiko.ada.*

class CelebritiesLoader
extends DataXMLLoader {
	
	private function parserFunction() {
		var events:Array = xml.firstChild.childNodes;
			var eventsData:Array = new Array();
			var oEvent:Object;
			for (var i:Number = 0; i < events.length; i++) {
				oEvent = new Object();
				oEvent.id = events[i].attributes.id;
				oEvent.title = events[i].attributes.title;
				oEvent.description = events[i].attributes.description;
				var oCelebrity:Object;
				var celebrities:Array = events[i].childNodes;
				var celebritiesData:Array = new Array();
				for (var i2:Number = 0; i2 < celebrities.length; i2++) {
					oCelebrity = new Object();
					oCelebrity.id = celebrities[i2].attributes.id;
					oCelebrity.description = celebrities[i2].attributes.description;
					oCelebrity.src = celebrities[i2].attributes.src;
					celebritiesData.push(oCelebrity);
				}
				oEvent.celebrities = celebritiesData;
				eventsData.push(oEvent);
			}
		this.data = eventsData;
		loadEnd();
	}
	
}